package com.aldd.mapper;

import com.aldd.entity.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface BookMapper {
    @Select("select book_id bookId,book_name bookName from book")
    List<Book> selectAllBook();

    @Select("select book_id bookId,book_name bookName from book where book_id=#{id}")
    Book selectBookById(int id);

    @Delete("delete from book where book_id=#{id}")
    int deleteBook(int id);

    @Insert("insert into book(book_name)values (#{bookName})")
    int insertBook(Book book);

    @Update("update book set book_name=#{bookName} where book_id=#{bookId}")
    int updateBook(Book book);
}
